<%@page import="model.Stock"%>
<%@page import="model.Descriptionarret"%>
<%@page import="web.Operation"%>
<%@page import="web.UhtBeans"%>
<%@page import="java.util.ArrayList"%>

<%@page import="java.util.Iterator"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<! DOCTYPE html>
    
    <script type="text/javascript">
var tableToExcel = (function() {
  var uri = 'data:application/vnd.ms-excel;base64,'
    , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>'
    , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
    , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
  return function(table, name) {
    if (!table.nodeType) table = document.getElementById(table)
    var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
    window.location.href = uri + base64(format(template, ctx))
  }
})()
</script>

<div id="export" ><input type="button" onclick="tableToExcel('testTable2', 'W3C Example Table')" value="     Export to Excel   ">
</div>
<p></p>
		<center>
		
		<table border="1" id="testTable2" border="1" width=100% class="table table-hover">
	<thead>
	<tr align="center" >
		<th width="50%">Postes</th>
		<th>Poste1 (22h-06h)</th>
		<th>Poste2 (06h-14h)</th>
		<th>Poste3 (14h-22h)</th>
		<th>Total Journé</th>
	</tr>
	</thead>
	
	<%
UhtBeans stockss;
if(request.getAttribute("stock") != null){
	
	stockss =(UhtBeans) request.getAttribute("stock");
	
}else {
	Operation opers = new Operation();
	stockss = new UhtBeans();
	stockss.setListSt(opers.allStock());
}

%>
			<%
		
			Iterator<Stock> lists = stockss.getListSt().iterator();
		        while(lists.hasNext()){
		        	Stock s =lists.next();
		        	 
				        	
			%>
	<tr>
		<th bgcolor="green" class="Date"><%=s.getDate() %></th>
	</tr>
	<tr align="center" bgcolor="cyan">
		<th>DIAGRAMME TEMPS</th>
		<th>Durée(min)</th>
		<th>Durée(min)</th>
		<th>Durée(min)</th>
		<th>Durée(min)</th>
	</tr>
	<tbody id="colonne">
	<tr align="center">
		<th bgcolor="yellow">Temps Calendrier</th>
		<%int d=480; %>
		<th id="d" class="Duree"><%=d %></th>
		<th ></th>
		<th></th>
		<th></th>
	</tr>
	
	<tr align="right">
		<th bgcolor="red">Temps non disponible</th>
		<th class="Duree" id="d11"><%
				System.out.println("ID DU CATEGORIE EST : "+request.getAttribute("iddd"));
		if (request.getAttribute("iddd") == "0"){
			
		%>
		<input type="number" id="d1" class="form-control" value="<%=s.getDuree() %>">
			
			<%} %>
		</th>
		<th></th>
		<th></th>
		<th></th>
		
	</tr>
	
	<tr align="center">
		<th bgcolor="yellow">Temps Disponible</th>
		<%int d2; 
		d2=d; %>
		<th><%=d2 %></th>
		<th></th>
		<th></th>
		<th></th>
	</tr>
	<tr align="right">
		<th bgcolor="red">Temps disponible non utilisé</th>
		<th  class="Duree">
		<%System.out.println("ID De TDNU EST : "+ request.getAttribute("iddd"));
		if(request.getAttribute("iddd") == "1"){
			%><%=s.getDuree()%>
			<%} %>
		</th>
		<th></th>
		<th></th>
		<th></th>
	</tr>
	<tr align="center">
		<th bgcolor="yellow">Temps d'ouverture</th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
	</tr>
	<tr align="right">
		<th bgcolor="red">Préventif et révision équipement</th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
	</tr>
	<tr align="right">
		<th bgcolor="red">Autres arrêts planifiés non OP</th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
	</tr>
	<tr align="center">
		<th bgcolor="yellow">Temps operationnel</th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
	</tr>
	<tr align="right">
		<th bgcolor="red">Nettoyage</th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
	</tr>
	<tr align="right">
		<th bgcolor="red">Autres arrêts OP planifiés</th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
	</tr>
	<tr align="center">
		<th bgcolor="yellow">Temps de production</th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
	</tr>
	<tr align="right">
		<th bgcolor="red">Arrêts organisationnels</th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
	</tr>
	<tr align="right">
		<th bgcolor="red">Arrêts techniques</th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
	</tr>
	<tr align="right">
		<th bgcolor="red">Arrêts  technologiques</th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
	</tr>
	<tr align="center">
		<th bgcolor="yellow">Running time</th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
	</tr>
	<tr align="center">
		<th bgcolor="yellow">Temps net de production</th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
	</tr>
	<%
		        }
				%>
	</tbody>
	
	<tr><th colspan="5"><br></th></tr>
	<tr align="center" bgcolor="cyan">
	<th>INDICATEURS DU CUTE</th>
	<th colspan="4">Valeur</th>
	</tr>
	<tr align="center" bgcolor="green">
	<th>Efficacité de production (PE)</th>
	<th></th>
	<th></th>
	<th></th>
	<th></th>
	</tr>
	<tr align="center" bgcolor="green">
	<th>Efficacité operationnelle (OE)</th>
	<th></th>
	<th></th>
	<th></th>
	<th></th>
	</tr>
	<tr align="center" bgcolor="green">
	<th>Efficacité énèrgetique (EE)</th>
	<th></th>
	<th></th>
	<th></th>
	<th></th>
	</tr>
	<tr align="center" bgcolor="green">
	<th>Maintenance planifiée (PM)</th>
	<th></th>
	<th></th>
	<th></th>
	<th></th>
	</tr>
	<tr align="center" bgcolor="green">
	<th>Nettoyage planifié (CIP)</th>
	<th></th>
	<th></th>
	<th></th>
	<th></th>
	</tr>
	<tr align="center" bgcolor="green">
	<th>Arrêts techniques (th)</th>
	<th></th>
	<th></th>
	<th></th>
	<th></th>
	</tr>
	<tr align="center" bgcolor="green">
	<th>Arrêts technologiques (TOD)</th>
	<th></th>
	<th></th>
	<th></th>
	<th></th>
	</tr>
	<tr align="center" bgcolor="green">
	<th>Utilisation operationnelle (OU)</th>
	<th></th>
	<th></th>
	<th></th>
	<th></th>
	</tr>
	<tr>

</table>
			</center>
		
		
		
		
		


